﻿<%@ Page Language="C#" MasterPageFile="~/Manager/Main.master" AutoEventWireup="true"
    CodeFile="UserMessager.aspx.cs" Inherits="Manager_UserMessager" Title="Untitled Page" %>

<%@ Register Src="~/WebControl/PageOn.ascx" TagName="PageOn" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div style="text-align: center;">
        <div style="font-size: 24px; font-weight: bold;">
            用户管理</div>
        <div>
            <table width="100%" border="1" cellpadding="0" cellspacing="0" id="userTable">
                <tbody>
                    <tr>
                        <th>
                        </th>
                        <th>
                            <input type="checkbox" name="selectAll" onclick="unSelect('box')" /></th>
                        <th>
                            用户名</th>
                        <th>
                            公司名称</th>
                        <th>
                            联系人</th>
                        <th>
                            QQ号码</th>
                        <th>
                            E-mail</th>
                        <th>
                            电话号码</th>
                        <th>
                            传真号码</th>
                        <th>
                            账号状态</th>
                        <th>
                            用户类型</th>
                        <th>
                            备注</th>
                        <th>
                            公司简介</th>
                    </tr>
                    <%= Content%>
                </tbody>
            </table>
        </div>
        <div style="width: 100%;">
            <uc1:PageOn ID="PageOn1" runat="server" OnPageChanged="PageOn1_PageChanged"></uc1:PageOn>
        </div>
        <div>
            <a style="text-decoration: none;">
                <input type="button" value="添加" style="margin-right: 10px;" onclick="add()" /></a>
            <a href="#" target="content" style="text-decoration: none;">
                <asp:Button ID="btnDelete" runat="server" Text="删除" OnClick="btnDelete_Click" OnClientClick="return confirm('确定要删除吗？');" /></a>
            <a style="text-decoration: none;">
                <input type="button" value="修改" onclick="update()" /></a>
        </div>
        <asp:TextBox ID="txtId" runat="server" Style="display: none;"></asp:TextBox>
    </div>

    <script type="text/javascript" language="javascript">
        //全选
        function selectAll(id,bool)
        {
            var pID=document.getElementById(id);
            var cb=pID.getElementsByTagName("input");
            
            for(var i=0;i<cb.length;i++)
            {
                if(cb[i].type=="checkbox")
                    cb[i].checked=bool;
            }
        }
        
        //反选
        function unSelect(sonName){
             var arrSon = document.getElementsByName(sonName);
            for(i=0;i<arrSon.length;i++) {
                arrSon[i].click();
            }
        }
        
        //单个选择
        function checkbox(){
            var str=document.getElementsByName("box");
            var objarray=str.length;
            var chestr="";
            
            for(var i=0;i<objarray;i++){
                if(str[i].checked==true){
                     chestr+=str[i].value+",";
                }
            }
            document.getElementById("ctl00_ContentPlaceHolder1_txtId").value=chestr;
        }
        
        function add()
        {
            window.location.href="UserMessager_Info.aspx";
        }
        
        function update(){
            var id=document.getElementById("ctl00_ContentPlaceHolder1_txtId").value;
            
            if(id!=""){
                var strId=id.split(",");
            if(strId.length-1>1){
                alert("只能修改单条用户信息，请重新选择！");
                return;
            }else{
                window.location.href="UserMessager_Info.aspx?id="+id;
            }
            }
        }
    </script>

</asp:Content>
